package com.baidu.mapper;

import com.baidu.pojo.TbGoodsAudit;
import com.baidu.vo.TbGoodsAuditVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Entity com.baidu.pojo.TbGoodsAudit
 */
@Mapper
@Component
public interface TbGoodsAuditMapper extends BaseMapper<TbGoodsAudit> {

    @Select("SELECT a.*,b.name from tb_goods_audit a LEFT JOIN tb_category b on a.cid = b.id where instr(a.name,#{name})")
    Page<TbGoodsAuditVo> findList(Page<TbGoodsAuditVo> page1, @Param("name") String name);

    @Update("update tb_goods_audit set status = 1 where id = #{id}")
    void auditReject(Long id);

    @Update("update tb_goods_audit set status = 2 where id = #{id}")
    void auditPass(Long id);
}




